<template>
  <div class="top-box">
    <div class="wiehfiuwef publicsedsef">
      <div class="weoifwe"></div>
      <span @click="titleClick">智慧养老社区平台管理系统</span>
    </div>
    <div class="sjfbejrybgf publicsedsef">
      <img src="" alt="" class="banner-img" />
      <div class="public-div rightDiv">
        <el-badge :value="3" :max="99" class="item">
          <i class="el-icon-message-solid"></i>
        </el-badge>
        <img class="user-name-img" :src="userImg" alt="" />

        <el-dropdown>
          <div class="dropdownClass">
            <span>{{ userName }}</span>
            <i class="el-icon-arrow-down" style="font-size: 19px"></i>
          </div>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="clickFucntion"
              >锁屏</el-dropdown-item
            >
            <el-dropdown-item @click.native="tuichuFunction"
              >退出</el-dropdown-item
            >
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "headerTop",
  data() {
    return {
      userName: "17863363763@qq.com",
      userImg: require("../../assets/可莉.png"),
    };
  },
  methods: {
    tuichuFunction() {
      this.$confirm("是否确认退出登录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          sessionStorage.removeItem("userMessage");
          this.$router.push("/login");
        })
        .catch(() => {});
    },
    clickFucntion() {
      this.$store.commit("global/lockScreenFunction", true);
    },
    titleClick(){
      this.$router.push('/homePage')
    }
  },
  mounted() {
    this.userName = JSON.parse(
      sessionStorage.getItem("userMessage")
    ).cellphoneNumber;
  },
};
</script>

<style lang="less" scoped>
.top-box {
  background-color: transparent;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .publicsedsef {
    height: 100%;
    display: flex;
    
    align-items: center;
  }
  .wiehfiuwef {
    width: 500px;
    span{
      margin-left: 19px;
      color: aliceblue;
      font-weight: 500;
      font-size: 32px;
      font-family: '华文行楷';
      user-select: none;
      cursor: pointer;
    }
    .weoifwe{
      width: 40px;
      height:53px;
      background:url('@/assets/ptlogo.png') ;
      background-size: 100% 100%;
    }
  }
  .sjfbejrybgf {
    justify-content: space-between;
    .rightDiv {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .el-icon-message-solid {
        text-align: center;
        width: 30px;
        line-height: 25px;
        font-size: 19px;
      }
      /deep/.el-badge__content {
        transform: translateY(-50%) translateX(100%) scale(0.9);
      }
      .user-name-img {
        margin: 0px 10px 0px 16px;
        width: 45px;
        height: 45px;
        border-radius: 50%;
        border: 1px solid white;
      }
      .dropdownClass {
        cursor: pointer;
        color: white;
        max-width: 170px;
        span {
          display: inline-block;
          margin-right: 10px;
          max-width: 140px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
        .el-icon-arrow-down {
          font-size: 14px;
        }
      }
    }
  }
}
</style>
